package log

import (
	"demo/cfg"
	"io"
	"log"
	"os"
)

// InitLog _
func InitLog() {

	logSec := cfg.Config.Section("LOG")
	logFile, err := os.OpenFile(logSec.Key("LOG_PATH").String(), os.O_CREATE|os.O_APPEND|os.O_RDWR, 0777)
	if err != nil {
		log.Fatalf("seek log cfg error: %v\n", err)
	}

	logWriter := io.MultiWriter(os.Stdout, logFile)
	log.SetOutput(logWriter)
}
